﻿using System;
using ETModel;

namespace Xfs
{
    /// gate session类型的Mailbox，收到的actor消息直接转发给客户端
    [XfsMailboxHandler(XfsSenceType.XfsServer, XfsMailboxType.GateSession)]
    public class S4C_XfsMailboxGateSessionHandler : IXfsMailboxHandler
    {
        public async XfsTask Handle(XfsSession session, XfsEntity entity, object actorMessage)
        {
            try
            {
                IXfsActorMessage iActorMessage = actorMessage as IXfsActorMessage;
                // 发送给客户端
                XfsSession clientSession = entity as XfsSession;
                iActorMessage.ActorId = 0;
                clientSession.Send(iActorMessage);
                await XfsTask.CompletedTask;
            }
            catch (Exception e)
            {
                //Log.Error(e);
            }
        }
       
    }
}
